package quna;

import java.util.Comparator;

/**
 * Created by lxy_920912 on 01/04/2017.
 */
public class compareList implements Comparator {
    @Override
    public int compare(Object o1, Object o2) {
        Hotel a= (Hotel)o1;
        Hotel b = (Hotel)o2;

        String  str1 = "";
        String str2 = "";
        for(int i= 0;i < 5;i++){
            str1 = str1+a.x[i];
            str2 = str2+b.x[i];
        }

        if(str1.compareTo(str2) != 0){
            return str1.compareTo(str2);
        }else{
            if((a.no-b.no) > 0){
                return 1;
            }else{
                return -1;
            }
        }
    }

}
